var point = "<div style='width:15px;height:15px;background-color:rgb(225,103,0);color:#fff;font-weight:bold;border-radius:25px;line-height:15px;text-align:center;float:left;margin:0 4px 0 -6px;'>!</div>";

var flag1 = 0;
var flag2 = 0;
var pwd ="";
var result ="";

function testPwd01(){
   var pbox = document.getElementById("pwd01");
   pwd = pbox.value;
   var textpwd = /((?=.*\d)(?=.*\D)|(?=.*[a-zA-Z])(?=.*[^a-zA-Z]))^.{8,16}$/;
   var massge =  document.getElementById("ss");

   if(pwd.length == 0){
	   pbox.style.border = "1px solid rgb(255,103,0)";
	   massge.innerHTML = point+"请输入密码"; 
   }else if(!textpwd.test(pwd)){
	    pbox.style.border = "1px solid rgb(255,103,0)";
	    massge.innerHTML = point+"密码长度8~16位，数字、字母、字符至少包含两种"; 
   }else{
	   pbox.style.border = "1px solid rgb(169,169,169)";
	   massge.innerHTML = ""; 
	   flag1 = 1;
   }
}

function testPwd02(){
   var pbox = document.getElementById("pwd02");
   var pwd02 = pbox.value;
   var massge =  document.getElementById("ss");
   if(pwd02.length == 0){
	   pbox.style.border = "1px solid rgb(255,103,0)";
	   massge.innerHTML = point+"请输入确认密码"; 
   }else if(pwd02 != pwd){
	   pbox.style.border = "1px solid rgb(255,103,0)";
	   massge.innerHTML = point+"密码不一致"; 
   }else{
	   pbox.style.border = "1px solid rgb(169,169,169)";
	   massge.innerHTML = ""; 
	   flag2 = 1;
   }
}

function clearMassge(str){
	var massge =  document.getElementById("ss");
	massge.innerHTML = ""; 
	if(str=="s1"){
	  document.getElementById("pwd01").style.border = "1px solid rgb(169,169,169)";
	  massge.innerHTML="<span style='color:gray'>密码长度8~16位，数字、字母、字符至少包含两种</span>";
	}else{
		document.getElementById("pwd02").style.border = "1px solid rgb(169,169,169)";
	}
}


function checkMassge(){
	var formstr = document.getElementById("forms");
   	if(flag1==1 && flag2==1){
		var truephone = document.getElementById("pid");
		alert("success");
		formstr.action = "index.html";
	}
}